const express = require('express')
const server = express()
const _ = require('lodash')
const cors = require('cors')
const arr = require('./stuName.js')

server.use(cors())

server.get('/api/rand', (req, res) => {
    const random = _.random(0, 10)
    // console.log(random)
    res.send(arr[random])
})
server.get('*', (req, res) => {
    res.status(404)
    res.send('请求的资源不存在')
})
server.listen(3000, () => {
    console.log('服务启动')
})